var grpc = require('grpc');
var protoDescriptor = grpc.load(__dirname + '/helloworld.proto');
var helloworld = protoDescriptor.helloworld;

function main() {
    var client = new helloworld.Greeter('localhost:50051');
    var user;
    if (process.argv.length >= 3) {
        user = process.argv[2];
    } else {
        user = 'world';
    }
    client.sayHello({name: user}, function (err, response) {
        console.log('Greeting:', response.message);
    });
}

main();